import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
import { TUpdateCareerSecond } from "../../../Message/Db/Tables/TUpdateCareerSecond";
import { ECareer } from "../../../Message/Public/ECareer";
type int = number;
//class SecondCareerConfig
    
    export  class SecondCareerConfig
    {
        constructor()
        {
            
            this._map = new Map<any, any> /* flash.utils.Dictionary */();
            this._careerMapF = new Map<any, any> /* flash.utils.Dictionary */();
            this._careerMapT = new Map<any, any> /* flash.utils.Dictionary */();
            this._careerMapW = new Map<any, any> /* flash.utils.Dictionary */();
            this._careerMapY = new Map<any, any> /* flash.utils.Dictionary */();
            if (SecondCareerConfig._instance != null) 
            {
                throw new Error(" CareerSecondConfig 单例 ");
            }
            this.init();
            return;
        }

        public SecondCareerConfig.get careerMapF(): Map<any, any> /* flash.utils.Dictionary */
        {
            return this._careerMapF;
        }

        public SecondCareerConfig.get careerMapT(): Map<any, any> /* flash.utils.Dictionary */
        {
            return this._careerMapT;
        }

        public SecondCareerConfig.get careerMapW(): Map<any, any> /* flash.utils.Dictionary */
        {
            return this._careerMapW;
        }

        public SecondCareerConfig.get careerMapY(): Map<any, any> /* flash.utils.Dictionary */
        {
            return this._careerMapY;
        }

        public init(): void
        {
            var loc1=ConfigManager.instance.getJSONByFileName("t_update_career_second.json");
            this.write(loc1);
            return;
        }

        /* internal  */write(arg1: Object): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=0;
            var loc4=arg1;
            for(loc2 of loc4) 
            {
                loc1 = new TUpdateCareerSecond();
                loc1.id = loc2.id;
                loc1.category = loc2.category;
                loc1.codeF = loc2.codeF;
                loc1.codeT = loc2.codeT;
                loc1.codeW = loc2.codeW;
                loc1.codeY = loc2.codeY;
                this._map[loc1.id] = loc1;
                this._careerMapF[loc1.category + "_" + loc1.codeF] = loc1;
                this._careerMapT[loc1.category + "_" + loc1.codeT] = loc1;
                this._careerMapW[loc1.category + "_" + loc1.codeW] = loc1;
                this._careerMapY[loc1.category + "_" + loc1.codeY] = loc1;
            }
            return;
        }

        public getSecondCode(arg1: int, arg2: int, arg3: int, arg4: int): int
        {
            var loc1=null;
            var loc2=arg3;
            switch (loc2) 
            {
                case ECareer._ECareerWarriorD:
                {
                    loc1 = this._careerMapW[arg1 + "_" + arg2];
                    break;
                }
                case ECareer._ECareerStabber:
                {
                    loc1 = this._careerMapY[arg1 + "_" + arg2];
                    break;
                }
                case ECareer._ECareerIceMage:
                {
                    loc1 = this._careerMapF[arg1 + "_" + arg2];
                    break;
                }
                case ECareer._ECareerPriest:
                {
                    loc1 = this._careerMapT[arg1 + "_" + arg2];
                    break;
                }
            }
            if (loc1) 
            {
                loc2 = arg4;
                switch (loc2) 
                {
                    case ECareer._ECareerWarriorD:
                    {
                        return loc1.codeW;
                    }
                    case ECareer._ECareerStabber:
                    {
                        return loc1.codeY;
                    }
                    case ECareer._ECareerIceMage:
                    {
                        return loc1.codeF;
                    }
                    case ECareer._ECareerPriest:
                    {
                        return loc1.codeT;
                    }
                }
            }
            return arg2;
        }

        public getRuneInfo(arg1: int, arg2: int): TUpdateCareerSecond
        {
            var loc1=this._careerMapW[arg2 + "_" + arg1];
            if (!loc1) 
            {
                loc1 = this._careerMapY[arg2 + "_" + arg1];
            }
            if (!loc1) 
            {
                loc1 = this._careerMapF[arg2 + "_" + arg1];
            }
            if (!loc1) 
            {
                loc1 = this._careerMapT[arg2 + "_" + arg1];
            }
            return loc1;
        }

        public static get instance(): SecondCareerConfig
        {
            if (SecondCareerConfig._instance == null) 
            {
                SecondCareerConfig._instance = new SecondCareerConfig();
            }
            return SecondCareerConfig._instance;
        }

        /* internal */ /* var */_map: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ /* var */_careerMapF: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ /* var */_careerMapT: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ /* var */_careerMapW: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ /* var */_careerMapY: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ static /* var */_instance: SecondCareerConfig;
    }
